package com.cssl.controller;

import com.cssl.domain.DtsRole;
import com.cssl.domain.dto.DtsRoleDto;
import com.cssl.openFeign.DtsRoleClient;

import com.cssl.util.InfoCode;
import com.cssl.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


@RestController
@RequestMapping("/role")
public class DtsRoleController {
    @Autowired
    private DtsRoleClient roleClient;

    @PostMapping("/roleOptions")
    public Result roleOptions() {


        return roleClient.roleOptions();

    }

    @PostMapping("/listRole")
    public Result getlistRole(@RequestBody DtsRoleDto dto) {

        return roleClient.getlistRole(dto);

    }

    @PostMapping("/createRole")
    public Result createRole(@RequestBody DtsRole role) {
        return roleClient.createRole(role);

    }

    @PostMapping("/updateRole")
    public Result updateRole(@RequestBody DtsRole role) {
        return roleClient.updateRole(role);

    }

    @PostMapping("/deleteRole")
    public Result deleteRole(@RequestBody DtsRole role) {
        return roleClient.deleteRole(role);
    }

    @PostMapping("/permissions")
    public Result permissions(@RequestBody DtsRole role) {
        System.out.println("permissions***:" + role);
        return roleClient.permissions(role);
    }
}
